<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<%
    request.setCharacterEncoding("UTF-8");
    String htmlData = request.getParameter("content1") != null ? request.getParameter("content1") : "";
%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
    String date = format.format(new Date());
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    <script type="text/javascript" src="<%=path%>/My97DatePicker/WdatePicker.js"></script>
    <link rel="stylesheet" type="text/css" href="<%=path%>/CSS/backLayout.css">
    <link rel="stylesheet" type="text/css" href="<%=path%>/CSS/bombBox.css">

</head>
<style>
    .seachform li span {
        color: #444444;
        padding-left: 60px;
    }

    li input {
        width: 80px;
    }

    select {
        width: 130px;
        height: 30px;
        line-height: 30px;
    }

    .seachform li {
        float: left;
    }

    .scinput {
        line-height: 10px;
        margin-top: 5px
    }

    .scinput1 {
        margin-top: -2px;
        height: 30px;
    }

    .scbtn {
        background: #57a0ff;
        border-radius: 20px;
        width: 110px;
        height: 35px;
        margin-left: 40px;
        font-size: 14px;
        font-weight: bold;
        color: #fff;
        cursor: pointer;
        outline: none;
        border: none;
    }

    thead {
        background: #f2f2f2
    }

    .template th {
        height: 45px;
        background: none;
    }

    .template tr {
        height: 45px;
    }

    .template tr th {
        height: 20px;
        border-left: 1px solid #dddee6;
        border-right: 1px solid #dddee6;
        color: #444444;
        text-align: center;
    }

    .tou {
        background: #e4eafe
    }

    .kh {
        border-bottom: 1px solid #dddee6;
    }

    .shuju td {
        border: 1px solid #dddee6;
        color: #787c88;
        text-align: center;
    }

    .shuju th {
        border: 1px solid #dddee6;
        color: #787c88;
        text-align: center;
    }

    .shuju:nth-child(odd) {
        background: #ffffff
    }

    .shuju:nth-child(even) {
        background: #f3f5fb
    }

    .shuju:last-child {
        border-bottom: 1px solid #dddee6;
    }

    .shuju:HOVER {
        background: #fff6cd;
    }

    ul {
        border: none;
    }

    .shuju td:first-child {
        width: 70px;
    }

    .shuju td:nth-child(2) {
        width: 70px;
    }

    #_td {
        width: 40px;
    }

    td {
        font-size: 14px;
    }

    #date2 {
        display: none;
    }

    #begindate {
        width: 180px;
    }

    tr {
        height: 28px;
    }
</style>
<body style="background: #f5f5f5">
<div class="main">
    <div class="weizhi">
        报表>>每日-招生人数\车型占比统计汇总表
    </div>
    <div class="div_body" style="height: 60px; min-height: 60px;margin-bottom: 0px; ">

        <form action="<%=path%>/DrivingSys/outXls" class="form" method="post">
            <ul class="seachform">
                <li>
                    <span class="scinput">报表类型&nbsp;:&nbsp;</span>
                    <select id="state">
                        <option value="0">日招生(明细)</option>
                        <option value="1">月度招生(汇总)</option>
                    </select></li>
                <li id="date"><span class="scinput1">月份&nbsp;:&nbsp;</span>
                    <input name="beginTime" id="begindate" value="${beginTime}" style="color: gray;"
                           onclick="WdatePicker({el:'begindate',dateFmt:'yyyy-MM'})"/>
                    <img onclick="WdatePicker({el:'begindate',dateFmt:'yyyy-MM '})"
                         src="<%=path%>/image/date.jpg" align="absmiddle" style="padding-left: 15px"></li>
                </li>
                <li id="date2"><span class="scinput1">年度&nbsp;:&nbsp;</span>
                    <input name="beginTime" id="begindate2" value="${beginTime}" style="color: gray;"
                           onclick="WdatePicker({el:'begindate2',dateFmt:'yyyy'})"/>
                    <img onclick="WdatePicker({el:'begindate2',dateFmt:'yyyy '})"
                         src="<%=path%>/image/date.jpg" align="absmiddle" style="padding-left: 15px"></li>
                </li>

                <li>
                    <input id="xls" type="hidden" name="xls" value="">
                    <input type="hidden" id="fileName" name="fileNames" value="部门日招生完成情况统计表">
                </li>
                <%--<shiro:hasPermission name="/outXls">--%>
                <li><label>&nbsp;</label><input name="" type="submit" id="dc"
                                                    class="scbtn" value="导出Excel" /></li>
                <%--</shiro:hasPermission>--%>
                <li>
                    <input type="button" class="scbtn" id="selsect" value="立即查询"/>
                </li>
            </ul>
        </form>

    </div>
    <div id="temp"
         style="width: 100%; overflow: auto; margin-bottom: 20px; margin-top: 30px; background: #fff; box-shadow: 0 0 10px #f2f2f2; min-height: 600px">

    </div>
</div>


</body>
<script type="text/javascript" src="<%=path%>/JQuery/jquery-1.8.2.js"></script>
<script type="text/javascript" src="<%=path%>/HoganJS/handlebars-v4.0.11.js"></script>
<script id="table-template-AdmSummary" type="text/x-handlebars-template">
    <div class="journaling">
        <table id="template" width="100%" align="center" style="min-height:30px;border-spacing:0;">
            <tr class="shuju">
                <th style="text-align:center; width: 20px;height: 25px; font-size: 18px;" colspan="17">
                    每日-招生人数\车型占比统计汇总表
                </th>
            </tr>
            <tr class="shuju">
                <th colspan="4" style="text-align:center; width: 10px;height: 25px; font-size: 16px;">单位名称：{{gsName}}
                </th>
                <th style=" text-align: center; " colspan="13">时间：<span
                        id="beginTime"></span></th>
            </tr>
            <tbody id="table1" style="border-spacing: 0px">
            <tr class="shuju">
                <th style="text-align:center; background: rgb(228,234,254)">车型</th>
                <th colspan="2" style="text-align:center; background: rgb(228,234,254)">A1</th>
                <th colspan="2" style="text-align:center; background: rgb(228,234,254)">A2</th>
                <th colspan="2" style="text-align:center; background: rgb(228,234,254)">A3</th>
                <th colspan="2" style="text-align:center; background: rgb(228,234,254)">B1</th>
                <th colspan="2" style="text-align:center; background: rgb(228,234,254)">B2</th>
                <th style="text-align:center; background: rgb(228,234,254)">合计</th>
                <th style="text-align:center; background: rgb(228,234,254)">C1</th>
                <th style="text-align:center; background: rgb(228,234,254)">C2</th>
                <th style="text-align:center; background: rgb(228,234,254)">二部C1</th>
                <th style="text-align:center; background: rgb(228,234,254)">三部C1</th>
                <th style="text-align:center; background: rgb(228,234,254)">总合计</th>
            </tr>
            <tr class="shuju">
                <th style="text-align:center; background: rgb(228,234,254)">日期</th>
                <th style="text-align:center; background: rgb(228,234,254)">人数</th>
                <th style="text-align:center; background: rgb(228,234,254)">占比</th>
                <th style="text-align:center; background: rgb(228,234,254)">人数</th>
                <th style="text-align:center; background: rgb(228,234,254)">占比</th>
                <th style="text-align:center; background: rgb(228,234,254)">人数</th>
                <th style="text-align:center; background: rgb(228,234,254)">占比</th>
                <th style="text-align:center; background: rgb(228,234,254)">人数</th>
                <th style="text-align:center; background: rgb(228,234,254)">占比</th>
                <th style="text-align:center; background: rgb(228,234,254)">人数</th>
                <th style="text-align:center; background: rgb(228,234,254)">占比</th>
                <th style="text-align:center; background: rgb(228,234,254)">人数</th>
                <th style="text-align:center; background: rgb(228,234,254)">人数</th>
                <th style="text-align:center; background: rgb(228,234,254)">人数</th>
                <th style="text-align:center; background: rgb(228,234,254)">人数</th>
                <th style="text-align:center; background: rgb(228,234,254)">人数</th>
                <th style="text-align:center; background: rgb(228,234,254)">人数</th>
            </tr>
            </tbody>
            <tbody id="table2">
            {{#each admissionNumberSummaryJournals}}
            <tr class="shuju">
                <td style="text-align: center;">{{zero fbizdate}}日</td>
                <td style="text-align: center;" class="carTypeA1">{{zero carTypeA1}}</td>
                <td style="text-align: center;" class="">{{division carTypeA1 sum}}%</td>
                <td style="text-align: center;" class="carTypeA2">{{zero carTypeA2}}</td>
                <td style="text-align: center;" class="">{{division carTypeA2 sum}}%</td>
                <td style="text-align: center;" class="carTypeA3">{{zero carTypeA3}}</td>
                <td style="text-align: center;" class="">{{division carTypeA3 sum}}%</td>
                <td style="text-align: center;" class="carTypeB1">{{zero carTypeB1}}</td>
                <td style="text-align: center;" class="">{{division carTypeB1 sum}}%</td>
                <td style="text-align: center;" class="carTypeB2">{{zero carTypeB2}}</td>
                <td style="text-align: center;" class="">{{division carTypeB2 sum}}%</td>
                <td style="text-align: center;" class="sumbig">{{sum5 carTypeA1 carTypeA2 carTypeA3 carTypeB1
                    carTypeB2}}
                </td>
                <td style="text-align: center;" class="carTypeC1">{{subtraction2 carTypeC1 twocarTypeC1
                    threecarTypeC1}}
                </td>
                <td style="text-align: center;" class="carTypeC2">{{zero carTypeC2}}</td>
                <td style="text-align: center;" class="twocarTypeC1">{{zero twocarTypeC1}}</td>
                <td style="text-align: center;" class="threecarTypeC1">{{zero threecarTypeC1}}</td>
                <td style="text-align: center;" class="sum">{{zero sum}}</td>
            </tr>
            {{/each}}
            </tbody>
            <tbody id="table3">
            <tr class="shuju">
                <td style="background-color: rgb(245,255,155); text-align: center;">总合计</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="carTypeA1"></td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="DcarTypeA1">2</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="carTypeA2">3</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="DcarTypeA2">4</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="carTypeA3">5</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="DcarTypeA3">6</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="carTypeB1">7</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="DcarTypeB1">8</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="carTypeB2">9</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="DcarTypeB2">10</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="sumbig">11</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="carTypeC1">12</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="carTypeC2">13</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="twocarTypeC1">14</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="threecarTypeC1">15</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="sum">16</td>
            </tr>
            </tbody>
        </table>
    </div>
</script>
<script id="table-template-AdmSummaryMonth" type="text/x-handlebars-template">
    <div class="journaling">
        <table id="template" width="100%" align="center" style="min-height:30px;border-spacing:0;">
            <tr class="shuju">
                <th style="text-align:center; width: 20px;height: 25px; font-size: 18px;" colspan="17">
                    每日-招生人数\车型占比统计汇总表
                </th>
            </tr>
            <tr class="shuju">
                <th colspan="4" style="text-align:center; width: 10px;height: 25px; font-size: 16px;">单位名称：{{gsName}}
                </th>
                <th style=" text-align: center; " colspan="13">时间：<span
                        id="beginTime2"></span></th>
            </tr>
            <tbody id="table1" style="border-spacing: 0px">
            <tr class="shuju">
                <th style="text-align:center; background: rgb(228,234,254)">车型</th>
                <th colspan="2" style="text-align:center; background: rgb(228,234,254)">A1</th>
                <th colspan="2" style="text-align:center; background: rgb(228,234,254)">A2</th>
                <th colspan="2" style="text-align:center; background: rgb(228,234,254)">A3</th>
                <th colspan="2" style="text-align:center; background: rgb(228,234,254)">B1</th>
                <th colspan="2" style="text-align:center; background: rgb(228,234,254)">B2</th>
                <th style="text-align:center; background: rgb(228,234,254)">合计</th>
                <th style="text-align:center; background: rgb(228,234,254)">C1</th>
                <th style="text-align:center; background: rgb(228,234,254)">C2</th>
                <th style="text-align:center; background: rgb(228,234,254)">二部C1</th>
                <th style="text-align:center; background: rgb(228,234,254)">三部C1</th>
                <th style="text-align:center; background: rgb(228,234,254)">总合计</th>
            </tr>
            <tr class="shuju">
                <th style="text-align:center; background: rgb(228,234,254)">日期</th>
                <th style="text-align:center; background: rgb(228,234,254)">人数</th>
                <th style="text-align:center; background: rgb(228,234,254)">占比</th>
                <th style="text-align:center; background: rgb(228,234,254)">人数</th>
                <th style="text-align:center; background: rgb(228,234,254)">占比</th>
                <th style="text-align:center; background: rgb(228,234,254)">人数</th>
                <th style="text-align:center; background: rgb(228,234,254)">占比</th>
                <th style="text-align:center; background: rgb(228,234,254)">人数</th>
                <th style="text-align:center; background: rgb(228,234,254)">占比</th>
                <th style="text-align:center; background: rgb(228,234,254)">人数</th>
                <th style="text-align:center; background: rgb(228,234,254)">占比</th>
                <th style="text-align:center; background: rgb(228,234,254)">人数</th>
                <th style="text-align:center; background: rgb(228,234,254)">人数</th>
                <th style="text-align:center; background: rgb(228,234,254)">人数</th>
                <th style="text-align:center; background: rgb(228,234,254)">人数</th>
                <th style="text-align:center; background: rgb(228,234,254)">人数</th>
                <th style="text-align:center; background: rgb(228,234,254)">人数</th>
            </tr>
            </tbody>
            <tbody id="table2">
            {{#each admissionNumberSummaryJournals}}
            <tr class="shuju">
                <td style="text-align: center;">{{zero fbizdate}}月</td>
                <td style="text-align: center;" class="carTypeA1">{{zero carTypeA1}}</td>
                <td style="text-align: center;" class="">{{division carTypeA1 sum}}%</td>
                <td style="text-align: center;" class="carTypeA2">{{zero carTypeA2}}</td>
                <td style="text-align: center;" class="">{{division carTypeA2 sum}}%</td>
                <td style="text-align: center;" class="carTypeA3">{{zero carTypeA3}}</td>
                <td style="text-align: center;" class="">{{division carTypeA3 sum}}%</td>
                <td style="text-align: center;" class="carTypeB1">{{zero carTypeB1}}</td>
                <td style="text-align: center;" class="">{{division carTypeB1 sum}}%</td>
                <td style="text-align: center;" class="carTypeB2">{{zero carTypeB2}}</td>
                <td style="text-align: center;" class="">{{division carTypeB2 sum}}%</td>
                <td style="text-align: center;" class="sumbig">{{sum5 carTypeA1 carTypeA2 carTypeA3 carTypeB1
                    carTypeB2}}
                </td>
                <td style="text-align: center;" class="carTypeC1">{{subtraction2 carTypeC1 twocarTypeC1
                    threecarTypeC1}}
                </td>
                <td style="text-align: center;" class="carTypeC2">{{zero carTypeC2}}</td>
                <td style="text-align: center;" class="twocarTypeC1">{{zero twocarTypeC1}}</td>
                <td style="text-align: center;" class="threecarTypeC1">{{zero threecarTypeC1}}</td>
                <td style="text-align: center;" class="sum">{{zero sum}}</td>
            </tr>
            <%--累计第一行 查询的历史数据--%>
            {{#if ljcarTypeA1}}
            <tr class="shuju">
                <td style="text-align: center;">累计</td>
                <td style="text-align: center;" class="ljcarTypeA1{{@index}}">{{zero ljcarTypeA1}}</td>
                <td style="text-align: center;" class=""></td>
                <td style="text-align: center;" class="ljcarTypeA2{{@index}}">{{zero ljcarTypeA2}}</td>
                <td style="text-align: center;" class=""></td>
                <td style="text-align: center;" class="ljcarTypeA3{{@index}}">{{zero ljcarTypeA3}}</td>
                <td style="text-align: center;" class=""></td>
                <td style="text-align: center;" class="ljcarTypeB1{{@index}}">{{zero ljcarTypeB1}}</td>
                <td style="text-align: center;" class=""></td>
                <td style="text-align: center;" class="ljcarTypeB2{{@index}}">{{zero ljcarTypeB2}}</td>
                <td style="text-align: center;" class=""></td>
                <td style="text-align: center;" class="ljsumbig{{@index}}">{{sum5 carTypeA1 carTypeA2 carTypeA3
                    carTypeB1
                    carTypeB2}}
                </td>
                <td style="text-align: center;" class="ljcarTypeC1{{@index}}">{{subtraction2 ljcarTypeC1 twocarTypeC1
                    threecarTypeC1}}
                </td>
                <td style="text-align: center;" class="ljcarTypeC2{{@index}}">{{zero ljcarTypeC2}}</td>
                <td style="text-align: center;" class="ljtwocarTypeC1{{@index}}">{{zero ljtwocarTypeC1}}</td>
                <td style="text-align: center;" class="ljthreecarTypeC1{{@index}}">{{zero ljthreecarTypeC1}}</td>
                <td style="text-align: center;" class="ljsum{{@index}}">{{zero ljsum}}</td>
            </tr>
            {{else}}
            <tr class="shuju">
                <td style="text-align: center;">累计</td>
                <td style="text-align: center;" class="ljcarTypeA1{{@index}}"></td>
                <td style="text-align: center;" class=""></td>
                <td style="text-align: center;" class="ljcarTypeA2{{@index}}"></td>
                <td style="text-align: center;" class=""></td>
                <td style="text-align: center;" class="ljcarTypeA3{{@index}}"></td>
                <td style="text-align: center;" class=""></td>
                <td style="text-align: center;" class="ljcarTypeB1{{@index}}"></td>
                <td style="text-align: center;" class=""></td>
                <td style="text-align: center;" class="ljcarTypeB2{{@index}}"></td>
                <td style="text-align: center;" class=""></td>
                <td style="text-align: center;" class="ljsumbig{{@index}}"></td>
                <td style="text-align: center;" class="ljcarTypeC1{{@index}}"></td>
                <td style="text-align: center;" class="ljcarTypeC2{{@index}}"></td>
                <td style="text-align: center;" class="ljtwocarTypeC1{{@index}}"></td>
                <td style="text-align: center;" class="ljthreecarTypeC1{{@index}}"></td>
                <td style="text-align: center;" class="ljsum{{@index}}"></td>
            </tr>
            {{/if}}
            {{/each}}
            </tbody>
            <tbody id="table3">
            <tr class="shuju">
                <td style="background-color: rgb(245,255,155); text-align: center;">总合计</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="carTypeA1"></td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="DcarTypeA1">2</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="carTypeA2">3</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="DcarTypeA2">4</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="carTypeA3">5</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="DcarTypeA3">6</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="carTypeB1">7</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="DcarTypeB1">8</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="carTypeB2">9</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="DcarTypeB2">10</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="sumbig">11</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="carTypeC1">12</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="carTypeC2">13</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="twocarTypeC1">14</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="threecarTypeC1">15</td>
                <td style="background-color: rgb(245,255,155); text-align: center;" id="sum">16</td>
            </tr>
            </tbody>
        </table>
    </div>
</script>
<script type="text/javascript">
    $(function () {
        $('#selsect').click()
    });
    //弹出框模版文件
    var myTemplate_AdmSummary = Handlebars.compile($("#table-template-AdmSummary").html());
    var myTemplate_AdmSummaryMonth = Handlebars.compile($("#table-template-AdmSummaryMonth").html());

    //注册一个比较内容是否为空
    Handlebars.registerHelper("isNull", function (v1, options) {
        if (v1 != "") {
            //满足添加继续执行
            return options.fn(this);
        } else {
            //不满足条件执行{{else}}部分
            return options.inverse(this);
        }
    });

    //注册一个比较大小的Helper,判断v1是否大于v2
    Handlebars.registerHelper("compare", function (v1, v2, options) {
        if (v2 == 100) {
            //满足添加继续执行
            return options.fn(this);
        }
        if (v1 == v2) {
            //满足添加继续执行
            return options.fn(this);
        } else {
            //不满足条件执行{{else}}部分
            return options.inverse(this);
        }
    });

    Handlebars.registerHelper("division", function (num1, num2) {
        if (num1 == 0 || num2 == 0 || num1 == null || num2 == null) {
            return 0;
        }
        return decimal((num1 / num2), 4) * 100;
    });
    Handlebars.registerHelper("sum2", function (num1, num2) {
        return (num1 * 1 + num2 * 1);
    });
    Handlebars.registerHelper("sum5", function (num1, num2, num3, num4, num5) {
        return (num1 * 1 + num2 * 1 + num3 * 1 + num4 * 1 + num5 * 1);
    });
    Handlebars.registerHelper("subtraction2", function (num1, num2, num3) {
        return (num1 * 1 - num2 * 1 - num3 * 1);
    });
    Handlebars.registerHelper("zero", function (num1) {
        if (num1 == null) {
            return 0;
        }
        else {
            return num1;
        }
    });

    Handlebars.registerHelper('addKey', function (index) {
        return index + 1;
    });


    function decimal(num, v) {
        var vv = Math.pow(10, v);
        return Math.round(num * vv) / vv;
    }

    $(document).on("change", 'select#state', function () {
        if ($('#state').val() == 0) {
            $('#date2').hide();
            $('#date').show();
            $('#selsect').click();
        }
        if ($('#state').val() == 1) {
            $('#date').hide();
            $('#date2').show();
            $('#begindate2').val('2017');
            $('#selsect').click();
        }
        if ($('#state').val() == 2) {
            $('#date').hide();
            $('#date2').show();
            $('#begindate2').val('2017');
            $('#selsect').click();
        }
    });


    $('#selsect').click(function () {
        cfoilspecName = $('#cfoilspecName').val()
        begindate = $('#begindate').val()
        begindate2 = $('#begindate2').val()
        $('#temp').html("<div class='loading'></div>");


        $.ajax({
            url: '<%=path%>/DrivingSys/selAdmissionNumberSummaryJournal',
            type: "post",
            data: {
                'cfoilspecName': cfoilspecName,
                'begindate': begindate,
                'begindate2': begindate2,
                'state': $('#state').val()
            },
            dataType: "json",
            success: function (res) {
                //如果是查询总报表 fbizDate字段为空
                if (res.state == 0) {
                    $('#temp').html(myTemplate_AdmSummary(res))
                    fomatDate(0);
                    $('#fileName').val('每日-招生人数\车型占比统计汇总表')
                }
                //部门月招生
                if (res.state == 1) {
                    $('#temp').html(myTemplate_AdmSummaryMonth(res))
                    fomatDate(1);
                    fomatDate(0);
                    $('#fileName').val('月度-招生人数\车型占比统计汇总表')
                }

                $('#beginTime').html($('#begindate').val())
                $('#beginTime2').html($('#begindate2').val())
                $('#endTime2').html($('#begindate2').val())
                $('#xls').val($('#temp').html())
            },
            error: function () {
                alert('Error');
            }
        });


    })

    function fomatDate(state) {
        if (state == 0) {
            var carTypeA1 = 0, carTypeA2 = 0, carTypeA3 = 0, carTypeB1 = 0,
                carTypeB2 = 0, carTypeC1 = 0, carTypeC2 = 0, twocarTypeC1 = 0,
                threecarTypeC1 = 0, sum = 0, sumbig = 0;
            $('.carTypeA1').each(function (i) {
                carTypeA1 += $(this).html() * 1
            })
            $('.carTypeA2').each(function (i) {
                carTypeA2 += $(this).html() * 1
            })
            $('.carTypeA3').each(function (i) {
                carTypeA3 += $(this).html() * 1
            })
            $('.carTypeB1').each(function (i) {
                carTypeB1 += $(this).html() * 1
            })
            $('.carTypeB2').each(function (i) {
                carTypeB2 += $(this).html() * 1
            })
            $('.sumbig').each(function (i) {
                sumbig += $(this).html() * 1
            })
            $('.carTypeC1').each(function (i) {
                carTypeC1 += $(this).html() * 1
            })
            $('.carTypeC2').each(function (i) {
                carTypeC2 += $(this).html() * 1
            })

            $('.twocarTypeC1').each(function (i) {
                twocarTypeC1 += $(this).html() * 1
            })
            $('.threecarTypeC1').each(function (i) {
                threecarTypeC1 += $(this).html() * 1
            })
            $('.sum').each(function (i) {
                sum += $(this).html() * 1
            })
            $('.sumbig').each(function (i) {
                sumbig += $(this).html() * 1
            })


            $('#carTypeA1').html(carTypeA1);
            $('#DcarTypeA1').html(division(carTypeA1 / sum));
            $('#carTypeA2').html(carTypeA2);
            $('#DcarTypeA2').html(division(carTypeA2 / sum));
            $('#carTypeA3').html(carTypeA3);
            $('#DcarTypeA3').html(division(carTypeA3 / sum));
            $('#carTypeB1').html(carTypeB1);
            $('#DcarTypeB1').html(division(carTypeB1 / sum));
            $('#carTypeB2').html(carTypeB2);
            $('#DcarTypeB2').html(division(carTypeB2 / sum));
            $('#sumbig').html(sumbig);
            $('#carTypeC1').html(carTypeC1);
            $('#carTypeC2').html(carTypeC2);
            $('#twocarTypeC1').html(twocarTypeC1);
            $('#threecarTypeC1').html(threecarTypeC1);
            $('#sum').html(sum);
        }
        //格式化各个月的累计
        if (state == 1) {
            for (var i = 0; i <= 12; i++) {
                $('.ljcarTypeA1' + (i + 1 * 1)).html($('.ljcarTypeA1' + i).html() * 1 + $('.carTypeA1').eq(i + 1).html() * 1);
            }
            for (var i = 0; i <= 12; i++) {
                $('.ljcarTypeA2' + (i + 1 * 1)).html($('.ljcarTypeA2' + i).html() * 1 + $('.carTypeA2').eq(i + 1).html() * 1);
            }
            for (var i = 0; i <= 12; i++) {
                $('.ljcarTypeA3' + (i + 1 * 1)).html($('.ljcarTypeA3' + i).html() * 1 + $('.carTypeA3').eq(i + 1).html() * 1);
            }
            for (var i = 0; i <= 12; i++) {
                $('.ljcarTypeB1' + (i + 1 * 1)).html($('.ljcarTypeB1' + i).html() * 1 + $('.carTypeB1').eq(i + 1).html() * 1);
            }
            for (var i = 0; i <= 12; i++) {
                $('.ljcarTypeB2' + (i + 1 * 1)).html($('.ljcarTypeB2' + i).html() * 1 + $('.carTypeB2').eq(i + 1).html() * 1);
            }
            for (var i = 0; i <= 12; i++) {
                $('.ljcarTypeC1' + (i + 1 * 1)).html($('.ljcarTypeC1' + i).html() * 1 + $('.carTypeC1').eq(i + 1).html() * 1);
            }
            for (var i = 0; i <= 12; i++) {
                $('.ljcarTypeC2' + (i + 1 * 1)).html($('.ljcarTypeC2' + i).html() * 1 + $('.carTypeC2').eq(i + 1).html() * 1);
            }
            for (var i = 0; i <= 12; i++) {
                $('.ljsumbig' + (i + 1 * 1)).html($('.ljsumbig' + i).html() * 1 + $('.sumbig').eq(i + 1).html() * 1);
            }
            for (var i = 0; i <= 12; i++) {
                $('.ljtwocarTypeC1' + (i + 1 * 1)).html($('.ljtwocarTypeC1' + i).html() * 1 + $('.twocarTypeC1').eq(i + 1).html() * 1);
            }
            for (var i = 0; i <= 12; i++) {
                $('.ljthreecarTypeC1' + (i + 1 * 1)).html($('.ljthreecarTypeC1' + i).html() * 1 + $('.threecarTypeC1').eq(i + 1).html() * 1);
            }
            for (var i = 0; i <= 12; i++) {
                $('.ljsum' + (i + 1 * 1)).html($('.ljsum' + i).html() * 1 + $('.sum').eq(i + 1).html() * 1);
            }
        }
    }

    function division(num1, num2) {
        if (num1 == 0 || num2 == 0 || num1 == null || num2 == null) {
            return 0 + "%";
        }
        return (num1 / num2).toFixed(2) + "%";
    }

</script>
<%@ include file="/WEB-INF/JSP/ajax.jsp" %>
</html>